package com.hxzy.yygh.hosp.controller;

import com.hxzy.yygh.common.result.Result;
import com.hxzy.yygh.hosp.service.ScheduleService;
import com.hxzy.yygh.model.hosp.Schedule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = "排班管理模块")
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    //查询排班数据接口
    @ApiOperation(value = "查询排班数据接口")
    @GetMapping("getScheduleList/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleList(
            @PathVariable Integer page , @PathVariable Integer limit,
            @PathVariable String hoscode, @PathVariable String depcode){
    Map<String,Object> resultMap = scheduleService.getScheduleList(page, limit, hoscode, depcode);
    return Result.ok(resultMap);
    }

    //查询对应日期的具体排班信息接口
    @ApiOperation(value = "查询对应日期的具体排班信息接口")
    @GetMapping("getScheduleDetails/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetails(
            @PathVariable String hoscode,
            @PathVariable String depcode,
            @PathVariable String workDate){
        List<Schedule> list = scheduleService.getDetailsSchedule(hoscode, depcode, workDate);
        return Result.ok(list);
    }

}
